from django import forms
from captcha.fields import CaptchaField

class LoginForm(forms.Form):
    username = forms.CharField(min_length=4, max_length=20,error_messages={'required':'账号不能为空','max_length':'账号太长','min_length':'账号太短'})
    password = forms.CharField(widget=forms.PasswordInput(),label='密码:',min_length=5,max_length=20,error_messages={'required':'密码不能为空','max_length':'密码太长','min_length':'密码太短'})
    # 验证码,参数：错误信息
    captcha = CaptchaField(label='验证码:',error_messages={'invalid': '验证码错误'})